c-variadic: use emit_ptr_va_arg for mips#152576
c-variadic: use emit_ptr_va_arg for mips#152576folkertdev wants to merge 3 commits intorust-lang:mainfrom
emit_ptr_va_arg for mips#152576Conversation
|
|
| bx, | ||
| addr, | ||
| target_ty, | ||
| PassMode::Direct, |
There was a problem hiding this comment.
Nothing in the LLVM implementation suggests a double load. byval is not handled.
There was a problem hiding this comment.
and there is no conditional logic based on the size either
| match bx.tcx().sess.target.pointer_width { | ||
| 32 => SlotSize::Bytes4, | ||
| 64 => SlotSize::Bytes8, | ||
| _ => unreachable!(), | ||
| }, |
There was a problem hiding this comment.
based on
unsigned ArgSlotSizeInBytes = (ABI.IsN32() || ABI.IsN64()) ? 8 : 4;| 64 => SlotSize::Bytes8, | ||
| _ => unreachable!(), | ||
| }, | ||
| AllowHigherAlign::Yes, |
There was a problem hiding this comment.
Because the code allows, and corrects for, a higher alignment
if (Align > getMinStackArgumentAlignment()) {| match bx.tcx().sess.target.endian { | ||
| Endian::Big => ForceRightAdjust::Yes, | ||
| Endian::Little => ForceRightAdjust::No, | ||
| }, |
There was a problem hiding this comment.
there is a whole comment about this
// In big-endian mode we must adjust the pointer when the load size is smaller
// than the argument slot size. We must also reduce the known alignment to
// match. For example in the N64 ABI, we must add 4 bytes to the offset to get
// the correct half of the slot, and reduce the alignment from 8 (slot
// alignment) down to 4 (type alignment).
|
Pinging some target maintainers: @Gelbpunkt @wzssyqa @chenx97 @709924470 @Cyanoxygen @Fearyncess Mostly this is just a heads-up. You could try to run (with your target) this test to be sure that it all works: this likely needs some sort of config in [target.mips64-unknown-linux-gnuabi64]
runner = "qemu-mips64 -L /usr/mips64-linux-gnuabi64"
[target.mipsel-unknown-linux-gnu]
runner = "qemu-mipsel -cpu 24Kf -L /usr/mipsel-linux-gnu"
[target.mips-unknown-linux-gnu]
runner = "qemu-mips -L /usr/mips-linux-gnu" |
tracking issue: #44930
After reading the implementation carefully, I believe it really is just
emit_ptr_va_arg.The LLVM implementation can be found here: https://github.com/llvm/llvm-project/blob/289a3292be0c6a3df86bcdf5be7dd05b79a5570c/llvm/lib/Target/Mips/MipsISelLowering.cpp#L2338.
r? workingjubilee